home *** CD-ROM | disk | FTP | other *** search
/ My Neighborhood / My Neighborhood.iso / mac / MacFiles / Police.Dxr / 00050_enter your phone number.ls < prev    next >
Encoding:
Text File  |  1997-11-18  |  1.2 KB  |  44 lines

  1. on keyDown
  2.   set temp to the key
  3.   set temp to charToNum(temp)
  4.   if (temp = 8) or (temp = 127) then
  5.     set lastchar to the number of chars in field "phone"
  6.     if lastchar = 1 then
  7.       put " " into field "phone"
  8.     else
  9.       delete char lastchar of field "phone"
  10.     end if
  11.   else
  12.     if (temp >= 48) and (temp <= 57) then
  13.       if the number of chars in field "phone" = 3 then
  14.         put "-" & the key after field "phone"
  15.       else
  16.         if the number of chars in field "phone" = 8 then
  17.           puppetSound("Cheng.S")
  18.           updateStage()
  19.         else
  20.           put the key after field "phone"
  21.           set tempChar to 0
  22.           repeat with T = 1 to the number of chars in field "phone"
  23.             if char T of field "phone" = " " then
  24.               set tempChar to T
  25.             end if
  26.           end repeat
  27.           if tempChar > 0 then
  28.             delete char tempChar of field "phone"
  29.           end if
  30.         end if
  31.       end if
  32.     else
  33.       if the number of chars in field "phone" = 3 then
  34.         if the key = "-" then
  35.           put "-" after field "phone"
  36.         end if
  37.       else
  38.         puppetSound("Cheng.S")
  39.         updateStage()
  40.       end if
  41.     end if
  42.   end if
  43. end
  44.